package vh.sphynx.jobengine;

import java.io.PrintStream;
import java.io.Serializable;

public abstract class AbstractJob implements Serializable, Job {

	private static final long serialVersionUID = 3208303306581350009L;
	
	protected JobExecutionEngine engine;

	public AbstractJob() {
		super();
	}

	/* (non-Javadoc)
	 * @see sphynx.jobengine.Job#executeJob(java.lang.Object)
	 */
	@Override
	public abstract void executeJob(Object args) throws Exception;
	
	protected PrintStream Log() {
		return engine != null ? engine.getLogStream() : null;
	}

	/* (non-Javadoc)
	 * @see sphynx.jobengine.Job#setEngine(sphynx.jobengine.JobExecutionEngine)
	 */
	@Override
	public void setEngine(JobExecutionEngine engine) {
		this.engine = engine;
	}

	/* (non-Javadoc)
	 * @see sphynx.jobengine.Job#getEngine()
	 */
	@Override
	public JobExecutionEngine getEngine() {
		return engine;
	}

}